window.addEventListener('load', function () {
    var swiper = new Swiper('.swiper-container', {
        slidesPerView: 1,
        spaceBetween: 30,
        loop: true,
        pagination: {
            el: '.swiper-pagination',
            clickable: true,
        },
        navigation: {
            nextEl: '.swiper-button-next',
            prevEl: '.swiper-button-prev',
        },

        autoplay: {
            delay: 2500,
            disableOnInteraction: false,
        },
    });

    var app = document.querySelector('.app');
    var closes = app.querySelector('li');
    closes.addEventListener('click', function () {
        app.style.display = 'none';
    });

    var serachWrap = document.querySelector('.serach-wrap');
    var appTop = serachWrap.offsetTop;
    
    console.log(appTop);
    document.addEventListener('scroll', function () {
        
        if (window.pageYOffset >= appTop) {
            console.log('触发条件');
            serachWrap.style.position = 'fixed';
            serachWrap.style.top = 0;
        } else {
            serachWrap.style.position = 'absolute';
            serachWrap.style.top = appTop + 'px';
        }
    })

})